import Vue from 'vue'
import Router from 'vue-router';
import UserVm from '../components/UserVm';
import ErrorPage from '../components/ErrorPage';
import indexPage from '../components/IndexPage';
import ParentVm from '../components/ParentVm';

Vue.use(Router);

const home = {template: '<div>home</div>'};
const news = {template: '<div>new</div>'};

export default new Router({
  mode:'history',
  routes: [
    {
      path:'/',
      component:indexPage
    },
    {
      path: '/home',
      component: home
    },
    {
      path: '/news',
      component: news
    },
    {
      path: '/user/:id',
      component: UserVm
    },

    {
      path: '/errorPage',
      name: "errorPage",
      component: ErrorPage
    },
    {
      path:"/ParentVm",
      name:'ParentVm',
      component:ParentVm
    },
    {
      path: '*',
      redirect: {
        name:'errorPage'
      }
    },

  ]
})
